class Solution {
public:
    string solve(string s, string t) {
        int m = s.size(), n = t.size();
        reverse(s.begin(), s.end());
        reverse(t.begin(), t.end());
        vector<int> v(m + n);
        // 1.无进位相乘再相加
        for (int i = 0; i < m; i++)
            for (int j = 0; j < n; j++)
                v[i + j] += (s[i] - '0') * (t[j] - '0');
        string ret;
        // 2.处理进位
        int k = 0;
        for (auto e : v)
        {
            k += e;
            ret += k % 10 + '0';
            k /= 10;
        }
        while (k)
        {
            ret += k % 10 + '0';
            k /= 10;
        }
        // 3.可能会有很多0的情况
        while (ret.size() > 1 && ret.back() == '0') ret.pop_back();
        reverse(ret.begin(), ret.end());
        return ret;
    }
};